/*! ******************************************************************************
 *
 * Created on 2021年9月25日
 *
 * Copyright(c) YuZhou Big Data Laboratory CO.,Ltd, 2022.  All rights reserved.
 *
 *******************************************************************************
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ******************************************************************************/

package org.yzbdl.lanius.util;

import org.pentaho.di.version.BuildVersion;
import org.yzbdl.lanius.authorize.machine.MachineInfo;
import org.yzbdl.lanius.authorize.verification.jar.JarValidate;
import org.yzbdl.lanius.authorize.verification.license.LaniusLicense;

import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;

/**
 * 获取机器码信息
 *
 * @author zg
 * @version 1.0
 * @date 2021/8/4 8:59
 */
public class MachineInfoEncrypt {

    public static Map<String, Object> getMachineInfoMap() {
        // 将选取的字符串复制到剪贴板并用对称加密方式加密、解密方式直接引用DESUtils类的Decrypt3DES方法
        Map<String, Object> jsonMap = new HashMap<>();
        jsonMap.put("customerInfo", "");
        // //解析license看机器码单个多个判定模式
//         Integer isSingleMachineCode = LicenseVerification.license != null ? LicenseVerification.license.getCertificationMode() : -1;//待调用判断方法
        // String mode = "";
        // switch (isSingleMachineCode) {
        // case 0:
        // mode = "批量";
        // break;
        // case 1:
        // mode = "单机";
        // break;
        // case -1:
        // mode = "试用";
        // break;
        // default:
        // mode = "试用";
        // }
        //// sbr.append("模式:" + mode + "\n\r");
        jsonMap.put("certificationMode", "");
        // 机器码
        jsonMap.put("machineCode", JarValidate.MACHINE_CODE);
        // 版本
        jsonMap.put("version", VersionUtil.getLaniusVersionTopTwo());
        // 获取硬件注册时间
        jsonMap.put("firmReleaseTIme", MachineInfo.getInstance().getFirmRegTime());
        // 硬件注册时间类型
        jsonMap.put("firmReleaseType", LaniusLicense.FirmReleaseType.OS);
        // 获取操作系统
        jsonMap.put("opSystem", MachineInfo.getInstance().getOpSystem());
        // 授权开始时间//社区版无
//        String authorationBeginTime = (LicenseVerification.getLicense() != null ? LicenseVerification.license.getCertificationBeginTime() : "");
        jsonMap.put("certificationBeginTime", LocalDate.now());
        // 授权结束时间//社区版无
        jsonMap.put("certificationEndTime", "");
        // 生成lincese时赋值
        jsonMap.put("certificationFunction", "");
        // 出品商信息
        jsonMap.put("developerInfo", BuildVersion.getInstance().getVendor());
        return jsonMap;
    }

}
